package com.example.bigevent.service;

import com.example.bigevent.pojo.Event;
import com.example.bigevent.mapper.EventMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EventService {
    @Autowired
    private EventMapper eventMapper;

    public void add(Event event) {
        eventMapper.add(event);
    }

    public List<Event> listByUserId(Integer userId) {
        return eventMapper.listByUserId(userId);
    }

    public Event findByIdAndUserId(Integer id, Integer userId) {
        return eventMapper.findByIdAndUserId(id, userId);
    }

    public void update(Event event) {
        eventMapper.update(event);
    }

    public void delete(Integer id, Integer userId) {
        eventMapper.delete(id, userId);
    }
}